from pyspark.ml.linalg import Vectors
from pyspark.sql import SparkSession
from pyspark.sql import Row

from pyspark.ml.clustering import KMeans, KMeansModel

spark = SparkSession.builder.master('local').appName('loadMysql').getOrCreate()

jdbcDF = spark.read.format('jdbc').option('driver', 'com.mysql.jdbc.Driver').option('url',
                                                                                    'jdbc:mysql://119.23.182.180:3306/mymess').option(
    'dbtable', 'vmessage').option('user', 'srp').option('password', 'srp').load()

jdbcDF.show()
